const { defineConfig } = require('@vue/cli-service')
const path = require('path')

function addStyleResource(rule) {
  rule.use('style-resource')
    .loader('style-resources-loader')
    .options({
      patterns: [
        path.resolve(__dirname, './src/styles/*.less'),
      ],
    })
}

module.exports = defineConfig({
  publicPath: './',
  productionSourceMap: false,
  transpileDependencies: true,
  chainWebpack: config => {
    const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
    types.forEach(type => addStyleResource(config.module.rule('less').oneOf(type)))
  },
  devServer: {
    proxy: {
      "^/openSciBeijingApi": {
        // target: "http://192.168.71.132:7177",
        target: "http://gooa.las.ac.cn",
      }
    }
  }
})
